<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Form extends MX_Controller
{
	public function __construct()
	{
		parent::__construct();
		$this->load->helper('form');
		

	}

	function index(){
		$this->load->library('form_validation');

		$model = $this->input->post();
	
		//validate
		$this->form_validation->set_rules('title', 'Tên', 'required');
		//end validate
		
		if ( substr($this->input->post('btnAction'), 0, 4) == 'save' ) {
			if ($this->form_validation->run() == FALSE)
			{
				
			}
			else{
				echo "ok";exit;
			}
		}
		$this->template
			->set('model',$model)
			->build('form');
	}
}